<section>
	<div class="page-header">
		<h2><?php echo $title; ?></h2>
	</div>
	
	<?php if ($pages) : ?>
	<table class="zebra-striped">
		<thead>
			<tr>
				<th>ID</th>
				<th>Title</th>
				<th>Type</th>
				<th>Category</th>
				<th>Website</th>
				<th width="140">Created</th>
				<th width="65">Featured</th>
				<th width="65">Published</th>
				<th width="75">Actions</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($pages as $page) : ?>
			<tr>
				<td><?php echo $page['content_id']; ?></td>
				<td><?php echo $page['title']; ?></td>
				<td><?php echo $page['ancestor_name'] ? $page['ancestor_name'] : $page['category_name']; ?>
				<td><?php echo $page['ancestor_id'] ? $page['parent_cat_name'] ? $page['parent_cat_name'] . ' &mdash; ' . $page['category_name'] : $page['category_name'] : '&mdash;'; ?></td>
				<td><?php echo $page['site_name']; ?></td>
				<td><?php echo display_time($page['created']); ?></td>
				<td><?php echo $page['featured'] == 'y' ? img('public/img/yes.png') : img('public/img/no.png'); ?></td>
				<td><?php echo $page['published'] == 'y' ? img('public/img/yes.png') : img('public/img/no.png'); ?>
				</td>
				<td><?php echo anchor('contents/edit_content/' . $page['content_id'], 'Edit'); ?> &nbsp; <?php echo anchor('contents/delete_content/' . $page['content_id'], 'Delete', array('class' => 'delete')); ?></td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
	<?php echo $this->pagination->create_links(); ?>
	<?php else : ?>
	<p>No records found.</p>
	<?php endif; ?>
	
</section>

<script>
	$('table .delete').click(function() {
        
        del = $(this);
        
        buildModal({
            modalID: 'deleteContent',
            modalHeader: 'Delete Content',
            modalBody: 'Are you sure that you want to delete this content?',
            btnPrimaryText: 'Delete',
			ajaxUrl: del.attr('href')
        });
        
        return false;
    });
</script>